package com.pipayshop.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.pipayshop.entity.AccountInfo;
import com.pipayshop.entity.vo.AccountInfoVO;

import java.math.BigDecimal;

/**
 * <p>
 * 用户账户表 服务类
 * </p>
 *
 * @author nws
 * @since 2023-07-25
 */
public interface UserAccountInfoService extends IService<AccountInfo> {

    /**
     * 根据用户Id查找用户账户表的积分余额和pi币余额
     * @param uid
     * @return
     * */
    AccountInfoVO selectAccountById(String uid);

    BigDecimal selectAccountBalance(String uid);

    //增加用户的积分余额
    Boolean addAccount(String uid, BigDecimal amount);

    //增加用户的Pi积分余额
    Boolean addPiAccount(String uid, BigDecimal amount);

    /**
     * 扣减用户的积分余额
     * @param uid
     * @param transactionAmount
     * @return
     */
    Boolean reduceAccount(String uid, BigDecimal transactionAmount);

    //冻结积分
    Boolean freezePoints(String uid, BigDecimal amount);
    /**
     * 减少冻结积分
     * @param uid
     * @param amount
     * @return 原有总积分
     */
    BigDecimal removeFrozen(String uid, BigDecimal amount);

    //解冻积分
    Boolean unfreezePoints(String uid, BigDecimal amount);
}
